package com.chinaunicom.structure.proxy.dynamicproxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2022/8/9 10:11
 * Description:
 */
public class CustomInvocationHandler implements InvocationHandler {
    private Object target;
    public CustomInvocationHandler(Object target){
        this.target = target;
    }
    
    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        System.out.println("invoke custom method function 。。。。。。");
        
        // 执行目标对象的目标方法
        return  method.invoke(this.target, args);
//        return null;
    }
}
